<template>
	<div class="box-left" v-loading="loading" element-loading-text="加载中" element-loading-background="rgba(0, 0, 0, 0.8)">
		<CommonModule name="年流转数据">
			<template v-slot:header>
				<el-date-picker v-model="year" value-format="yyyy" format="yyyy年" size="mini" type="year" placeholder="选择年" style="width: 10rem" :clearable="false"></el-date-picker>
			</template>
			<template v-slot:footer>
				<div class="data-board">
					<div class="lattice">
						<div class="text">
							<dv-decoration-9 :dur="8" style="width: 130px; height: 130px">{{ data1 }}</dv-decoration-9>
							<!-- <CountTo :startVal="0" :endVal="data1" :duration="4000" separator=""></CountTo> -->
						</div>
					</div>
				</div>
			</template>
		</CommonModule>
	</div>
</template>

<script>
import CommonModule from "./CommonModule.vue"
import CountTo from "vue-count-to"
import { getLZSJ } from "@/api/home.js"
import { mixinYear } from "./mixin.js"

export default {
	components: { CountTo, CommonModule },
	mixins: [mixinYear],
	data() {
		return {
			loading: false,
			data1: 0
		}
	},
	methods: {
		async getData() {
			try {
				this.loading = true

				let res1 = await getLZSJ({ year: this.year })
				// console.log(res1)
				this.data1 = res1.data

				this.loading = false
			} catch (error) {
				this.loading = false
				console.error("获取年流转数据数据错误", error)
				this.$modal.msgError("获取年流转数据数据错误")
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.box-left {
	width: 39.5%;
	height: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	flex-shrink: 0;
}

.data-board {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: space-evenly;
	box-sizing: border-box;
	overflow: hidden;
	.lattice {
		height: 100%;
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: center;
		white-space: nowrap;
		.text {
			font-size: 2.125rem;
			letter-spacing: 0.125rem;
			text-align: center;
			font-family: 黑体;
			color: white;
			margin-bottom: 0.25rem;
		}
	}
}
</style>
